/**
 */
package de.thwildau.tm.moses.xabnf.xabnf.impl;

import de.thwildau.tm.moses.abnf.abnf.AbnfPackage;

import de.thwildau.tm.moses.xabnf.xabnf.Binding;
import de.thwildau.tm.moses.xabnf.xabnf.Bindings;
import de.thwildau.tm.moses.xabnf.xabnf.ClassBinding;
import de.thwildau.tm.moses.xabnf.xabnf.FieldBinding;
import de.thwildau.tm.moses.xabnf.xabnf.GeneratorModel;
import de.thwildau.tm.moses.xabnf.xabnf.Language;
import de.thwildau.tm.moses.xabnf.xabnf.RuleBinding;
import de.thwildau.tm.moses.xabnf.xabnf.Xabnf;
import de.thwildau.tm.moses.xabnf.xabnf.XabnfFactory;
import de.thwildau.tm.moses.xabnf.xabnf.XabnfPackage;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class XabnfPackageImpl extends EPackageImpl implements XabnfPackage
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass xabnfEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass generatorModelEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass bindingsEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass bindingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass ruleBindingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass fieldBindingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass classBindingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum languageEEnum = null;

  /**
   * Creates an instance of the model <b>Package</b>, registered with
   * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
   * package URI value.
   * <p>Note: the correct way to create the package is via the static
   * factory method {@link #init init()}, which also performs
   * initialization of the package, or returns the registered package,
   * if one already exists.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see org.eclipse.emf.ecore.EPackage.Registry
   * @see de.thwildau.tm.moses.xabnf.xabnf.XabnfPackage#eNS_URI
   * @see #init()
   * @generated
   */
  private XabnfPackageImpl()
  {
    super(eNS_URI, XabnfFactory.eINSTANCE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private static boolean isInited = false;

  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
   * 
   * <p>This method is used to initialize {@link XabnfPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static XabnfPackage init()
  {
    if (isInited) return (XabnfPackage)EPackage.Registry.INSTANCE.getEPackage(XabnfPackage.eNS_URI);

    // Obtain or create and register package
    XabnfPackageImpl theXabnfPackage = (XabnfPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XabnfPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XabnfPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    AbnfPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theXabnfPackage.createPackageContents();

    // Initialize created meta-data
    theXabnfPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theXabnfPackage.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(XabnfPackage.eNS_URI, theXabnfPackage);
    return theXabnfPackage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getXabnf()
  {
    return xabnfEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getXabnf_GeneratorModel()
  {
    return (EReference)xabnfEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getXabnf_Bindings()
  {
    return (EReference)xabnfEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getGeneratorModel()
  {
    return generatorModelEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getGeneratorModel_File()
  {
    return (EAttribute)generatorModelEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getGeneratorModel_Language()
  {
    return (EAttribute)generatorModelEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getGeneratorModel_Package()
  {
    return (EAttribute)generatorModelEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getGeneratorModel_EntryRule()
  {
    return (EReference)generatorModelEClass.getEStructuralFeatures().get(3);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getGeneratorModel_Encoding()
  {
    return (EAttribute)generatorModelEClass.getEStructuralFeatures().get(4);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getBindings()
  {
    return bindingsEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getBindings_Binding()
  {
    return (EReference)bindingsEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getBinding()
  {
    return bindingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getBinding_Rule()
  {
    return (EReference)bindingEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRuleBinding()
  {
    return ruleBindingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getRuleBinding_TargetRuleName()
  {
    return (EAttribute)ruleBindingEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getRuleBinding_FieldBindings()
  {
    return (EReference)ruleBindingEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getFieldBinding()
  {
    return fieldBindingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getFieldBinding_Name()
  {
    return (EAttribute)fieldBindingEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getFieldBinding_Type()
  {
    return (EReference)fieldBindingEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getFieldBinding_TargetName()
  {
    return (EAttribute)fieldBindingEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getClassBinding()
  {
    return classBindingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getClassBinding_ClassName()
  {
    return (EAttribute)classBindingEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getClassBinding_MethodName()
  {
    return (EAttribute)classBindingEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getLanguage()
  {
    return languageEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public XabnfFactory getXabnfFactory()
  {
    return (XabnfFactory)getEFactoryInstance();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isCreated = false;

  /**
   * Creates the meta-model objects for the package.  This method is
   * guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void createPackageContents()
  {
    if (isCreated) return;
    isCreated = true;

    // Create classes and their features
    xabnfEClass = createEClass(XABNF);
    createEReference(xabnfEClass, XABNF__GENERATOR_MODEL);
    createEReference(xabnfEClass, XABNF__BINDINGS);

    generatorModelEClass = createEClass(GENERATOR_MODEL);
    createEAttribute(generatorModelEClass, GENERATOR_MODEL__FILE);
    createEAttribute(generatorModelEClass, GENERATOR_MODEL__LANGUAGE);
    createEAttribute(generatorModelEClass, GENERATOR_MODEL__PACKAGE);
    createEReference(generatorModelEClass, GENERATOR_MODEL__ENTRY_RULE);
    createEAttribute(generatorModelEClass, GENERATOR_MODEL__ENCODING);

    bindingsEClass = createEClass(BINDINGS);
    createEReference(bindingsEClass, BINDINGS__BINDING);

    bindingEClass = createEClass(BINDING);
    createEReference(bindingEClass, BINDING__RULE);

    ruleBindingEClass = createEClass(RULE_BINDING);
    createEAttribute(ruleBindingEClass, RULE_BINDING__TARGET_RULE_NAME);
    createEReference(ruleBindingEClass, RULE_BINDING__FIELD_BINDINGS);

    fieldBindingEClass = createEClass(FIELD_BINDING);
    createEAttribute(fieldBindingEClass, FIELD_BINDING__NAME);
    createEReference(fieldBindingEClass, FIELD_BINDING__TYPE);
    createEAttribute(fieldBindingEClass, FIELD_BINDING__TARGET_NAME);

    classBindingEClass = createEClass(CLASS_BINDING);
    createEAttribute(classBindingEClass, CLASS_BINDING__CLASS_NAME);
    createEAttribute(classBindingEClass, CLASS_BINDING__METHOD_NAME);

    // Create enums
    languageEEnum = createEEnum(LANGUAGE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isInitialized = false;

  /**
   * Complete the initialization of the package and its meta-model.  This
   * method is guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void initializePackageContents()
  {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Obtain other dependent packages
    AbnfPackage theAbnfPackage = (AbnfPackage)EPackage.Registry.INSTANCE.getEPackage(AbnfPackage.eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes
    ruleBindingEClass.getESuperTypes().add(this.getBinding());
    classBindingEClass.getESuperTypes().add(this.getBinding());

    // Initialize classes and features; add operations and parameters
    initEClass(xabnfEClass, Xabnf.class, "Xabnf", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getXabnf_GeneratorModel(), this.getGeneratorModel(), null, "generatorModel", null, 0, 1, Xabnf.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getXabnf_Bindings(), this.getBindings(), null, "bindings", null, 0, 1, Xabnf.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(generatorModelEClass, GeneratorModel.class, "GeneratorModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getGeneratorModel_File(), ecorePackage.getEString(), "file", null, 0, 1, GeneratorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getGeneratorModel_Language(), this.getLanguage(), "language", null, 0, 1, GeneratorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getGeneratorModel_Package(), ecorePackage.getEString(), "package", null, 0, 1, GeneratorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getGeneratorModel_EntryRule(), theAbnfPackage.getRule(), null, "entryRule", null, 0, 1, GeneratorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getGeneratorModel_Encoding(), ecorePackage.getEString(), "encoding", null, 0, 1, GeneratorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(bindingsEClass, Bindings.class, "Bindings", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getBindings_Binding(), this.getBinding(), null, "binding", null, 0, -1, Bindings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(bindingEClass, Binding.class, "Binding", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getBinding_Rule(), theAbnfPackage.getRule(), null, "rule", null, 0, 1, Binding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(ruleBindingEClass, RuleBinding.class, "RuleBinding", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getRuleBinding_TargetRuleName(), ecorePackage.getEString(), "targetRuleName", null, 0, 1, RuleBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getRuleBinding_FieldBindings(), this.getFieldBinding(), null, "fieldBindings", null, 0, -1, RuleBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(fieldBindingEClass, FieldBinding.class, "FieldBinding", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getFieldBinding_Name(), ecorePackage.getEString(), "name", null, 0, 1, FieldBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getFieldBinding_Type(), theAbnfPackage.getRule(), null, "type", null, 0, 1, FieldBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getFieldBinding_TargetName(), ecorePackage.getEString(), "targetName", null, 0, 1, FieldBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(classBindingEClass, ClassBinding.class, "ClassBinding", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getClassBinding_ClassName(), ecorePackage.getEString(), "className", null, 0, 1, ClassBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getClassBinding_MethodName(), ecorePackage.getEString(), "methodName", null, 0, 1, ClassBinding.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Initialize enums and add enum literals
    initEEnum(languageEEnum, Language.class, "Language");
    addEEnumLiteral(languageEEnum, Language.JAVA);
    addEEnumLiteral(languageEEnum, Language.CPLUS_PLUS);
    addEEnumLiteral(languageEEnum, Language.C);

    // Create resource
    createResource(eNS_URI);
  }

} //XabnfPackageImpl
